﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using DTO;
using BLL;
using System.IO;
using System.Drawing;
using System.Data;
using System.Security.Cryptography;

namespace ConsoleApplication1
{
    class Program
    {
        public static string passphrase = "123";
        static void Main(string[] args)
        {
            try
            {
                TKDangNhapDTO tk = new TKDangNhapDTO();
                tk.MaTaiKhoan = "9999";
                tk.Username = "nhan1";
                tk.Password = passphrase;
                //new TKDangNhapBLL().Insert(tk);
                bool kt = new TKDangNhapBLL().CheckUerName_Password(ref tk);
                Console.WriteLine(kt);
                Console.WriteLine(tk.MaTaiKhoan);
                Console.WriteLine(tk.Password??"null");
            }
            catch (Exception e)
            {
                Console.Write(e.Message);
            }
            Console.ReadKey();
        }

        public static byte[] imageToByteArray(Image imageIn)
        {
            MemoryStream ms = new MemoryStream();
            imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
            return ms.ToArray();
        }

        public static Image byteArrayToImage(byte[] byteArrayIn)
        {
            MemoryStream ms = new MemoryStream(byteArrayIn);
            Image returnImage = Image.FromStream(ms);
            return returnImage;
        }
    }
}
